from phot_server.server_config import global_config
import os
import platform

MINIO_EXE_PATH = os.path.abspath(
    os.path.join(global_config.BASE_ROOT, global_config.__config["PhotServer"]["MinIO"]["exe_file"]))
MINIO_BLUCKET_ROOT = os.path.abspath(
    os.path.join(global_config.BASE_ROOT, global_config.__config["PhotServer"]["MinIO"]["blucket_root"]))
MINIO_CONSOLE_ADDRESS = global_config.__config["PhotServer"]["MinIO"]["console-address"]
MINIO_ADDRESS = global_config.__config["PhotServer"]["MinIO"]["address"]
os.environ["MINIO_ROOT_USER"] = platform.node()
os.environ["MINIO_ROOT_PASSWORD"] = platform.node()

MINIO_CONF = {
    'endpoint': MINIO_ADDRESS,
    'access_key': os.environ["MINIO_ROOT_USER"],
    'secret_key': os.environ["MINIO_ROOT_PASSWORD"],
    'secure': False
}

minio_config_dict = {"MINIO_EXE_PATH": MINIO_EXE_PATH,
                     "MINIO_BLUCKET_ROOT": MINIO_BLUCKET_ROOT,
                     "MINIO_CONSOLE_ADDRESS": MINIO_CONSOLE_ADDRESS,
                     "MINIO_ADDRESS": MINIO_ADDRESS,
                     "MINIO_ROOT_USER": os.environ["MINIO_ROOT_USER"],
                     "MINIO_ROOT_PASSWORD": os.environ["MINIO_ROOT_PASSWORD"],
                     "MINIO_CONF": MINIO_CONF
                     }
